import React from "react";
import { Redirect } from "react-router-dom";

export default function Home({ location }) {
  if (!location.state) {
    return <Redirect to="/login/code" />;
  }

  const { username, avatar } = location.state;

  return (
    <div>
      <h1>{username}</h1>
      <img src={avatar} alt="avatar" />
    </div>
  );
}
